package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

/**
 * @author liyang
 * @version 1.0
 * @package reflect
 * @file ReflectDemo9.java
 * @description
 * @time 2024/6/27 下午9:53
 */
//如何访问注解里的参数
public class ReflectDemo9 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("reflect.Person");
        Method method = cls.getDeclaredMethod("sayHello");
        if (method.isAnnotationPresent(AutoRunMethod.class)) {
            AutoRunMethod arm = method.getAnnotation(AutoRunMethod.class);
            int value  = arm.value();
            System.out.println("该注解的参数值为："+value);
        }




    }
}
